<?php
  $lat=53.430606;
  $lng=14.556541;
  $zoom=12;
  $width=650;
  $height=300;
?>
<form name="kml_export" method="POST" action="?module=<?php
      echo $_GET['module'];
      ?>&amp;action=exportFromList" >
<table border="1" cellpadding="0" cellspacing="0" id="points" >
   <thead> <tr class="b">
      <th width= "10" > &#160; </th>
      <th width= "65" class="header"> lon  </th>
      <th width= "65" class="header" > lat </th>
      <th width= "25"> map </th>
      <th width= "100" class="header"> name </th>
      <th width= "135" class="header"> opis</th>
      <th width= "125" class="header"> kategoria</th>
   </tr>
   </thead>
<tbody>
<?php
   while ($r=mysql_fetch_array($database->result))
   {
//      echo '<tr> <td  ><input type="checkbox" name="checkbox[]" id="'.$r2['id'].'" value="'.$r2['id'].'" /></td>
//                    <td  >'.$r2['lon'].'</td> <td  >'.$r2['lat'].'</td> <td  >'. $r2['name'].'</td>
//                  <td >'. $r2['desc'].'</td>
//                  <td  >'. $r2['cname']. '</td>';
      echo '<tr> <td  ><input type="checkbox" name="checkbox[]" id="'.$r['id'].'" value="'.$r['id'].'" /></td>
                    <td id="lon'.$r['id'].'" >'.$r['lon'].'</td> <td id="lat'.$r['id'].'" >'.$r['lat']
   .'</td><td><img alt="ShowOnMap" class="map_img" src="images/showmap_small.jpg"'
   .' onClick="SetPosition('.$r['lat'].', '.$r['lon'].','.$r['id'].' )">'
     .'</td> <td id="n'.$r['id'].'">'. $r['name'].'</td>
                  <td id="d'.$r['id'].'">'. $r['desc'].'</td>
                  <td>'. $r['cname'].' /'.$r['uname']. '</td>';
      echo '</tr>';
   }
?>
</tbody>
</table>
<input type="button" name="check" size="20" value="Zaznacz wszystkie" id="checkbtn" onclick="unCheckAll()">
<br>
<br>
Zaznaczone punkty:<br>
<input type="radio" name="radiobtn" value="kml" onClick="showInput('skml')">eksportuj do KML <span id="skml"></span>
<br><input type="radio" name="radiobtn" value="gps" onClick="showInput('sgpx')">eksportuj do GPX <span id="sgpx"></span>
<br><input type="radio" name="radiobtn" value="del" onClick="showInput('sdel')">usuń z listy<span id="sdel"></span>
<input type="hidden" name="list_id" value="<?php echo $idListy;?>" >
<br><input type="radio" name="radiobtn" value="add" onClick="showInput('sadd')">dodaj do listy

 <span id="sadd" style="display:none">
 <select name="selectlist" class="styled" style="display:none" size="1" id="selectlist"  onclick="listNameClicked()" >
   <option value="-1.ch" id="firstselect" >Wybierz listę</option>
   <?php //dodawanie do listy
$i= 0;
//wczytywanie z DB nazwy list
echo 'session: ';
print_r($_SESSION);
$database->query("SELECT * FROM lists WHERE `ID_USER` =".$_SESSION['ID']." AND ID !=".$idListy );

$result=$database->getReturn();

while ($r=mysql_fetch_array($result))
{
   echo '<option value="'.$r['ID'].'.'.$r['name'].'">'.$r['name'].'</option>';
  // $i++;
}
?>
   </select>
<input type="text" class="nameInput" style="display:none" name="listNameInput" id="listNameInput" size="8"><br>
<input type="checkbox" name="deltoo">Usuń z aktualnej listy<br>    <input type="submit" name="addToList" value="Dodaj" onclick="return addToListClicked()" ></span> <br>

<input type="button" name="showAllOnMap" size="20" value="Pokaż na mapie" id="showAllOnMap" onclick="showCheckedPoints()">

</form>
<?php echo '<a href="index.php?module=user&action=generateTrackFromList&name='.$name.'&id='.$idListy.'" >';
?>Generuj trasę po punktach</a>
<div id="map" style="display:none; width: <?php echo $width; ?>px; height: <?php echo $height; ?>px"></div>
<script type="text/javascript">
      //<![CDATA[
var map;
var bounds;
      $j(document).ready(function() {
    // call the tablesorter plugin
    $j("#points").tablesorter({ headers: { 0:{sorter: false}, 3:{sorter: false}} });
});
      //]]>


      </script>